from django.db import models

# Create your models here.
from courses.models import Course
from utils.basemodel import BaseModel


class CourseExplain(BaseModel):
    """
    课程有效期表
    """
    course = models.ForeignKey(Course, on_delete=models.CASCADE, verbose_name="课程")
    expire_time = models.IntegerField(verbose_name="有效期", help_text="0表示永久有效")
    expire_text = models.CharField(max_length=32, verbose_name="有效期描述")
    price = models.FloatField(verbose_name="价格")

    class Meta:
        db_table = "drill_explain"
        verbose_name = "课程有效期表"
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.course.name + "有效期" + self.expire_text